<#-- 导入变量定义文件 -->
<#include "../template/include/assign.ftl">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>角色权限对应表页面</title>
<#-- 导入静态资源文件 -->
<#include "../template/include/source.ftl">
    <link href="${web_static}/admin/css/list.css" rel="stylesheet" type="text/css"/>
    <style type="text/css">
        .page {
            float: right;
            padding-top: 15px;
            margin-right: 15px;
        }
    </style>
    <script type="text/javascript" src="${web_static}/admin/js/list.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#searchButton').click(
                    function () {
                        $('#currentPage_listForm').val('1');
                    }
            );
        });


        function deleteRolePermission(serviceCode) {
            var result = confirm("你确认要删除吗?");
            if (result) {
                var url = "${web_base}/system/role_permission!delete.htm?serviceCode=" + serviceCode;
                //$('#listForm').attr("action","url");
                //$('#listForm').submit();
                document.forms[0].action = url;
                document.forms[0].submit();
            }
        }
    </script>
</head>
<#include "../template/template_listPage.ftl">
<body class="list">
<script type="text/javascript">
    $().ready(function () {
		<#if actionErrors??&&(actionErrors?size > 0)>
			$.dialog({type: "warn", content: "<#list errorMessages as list>${list}<br></#list>",
			 modal: true, autoCloseTime: 3000});
		</#if>

    });
</script>
<div class="body">
    <div class="listBar">
        <h1><span class="icon">&nbsp;</span>角色权限对应表&nbsp;</h1>
    </div>
<@pageList page=(page!) id="listForm" action="${web_base}/system/role_permission!list.htm" query="rp" isEmpty=true >
    <table class="listTable">
        <tr>
            <th width="80">
                <span class="sort" name="roleName">角色名</span>
            </th>

            <th>
                <span class="sort" name="state">权限名</span>
            </th>

            <th width="40">
                操 作
            </th>
        </tr>

        <#if page??&&page.list??&&(page.list?size gt 0)>
            <#list page.list as entry>
                <tr>
                    <td width="120">
                    ${(entry.roleName)!}
                    </td>
                    <td>
                        <#list entry.permissions as p>
                            <#if p_index<=26>
                                <#if p_index%13=0><br/></#if>
                            ${(p.name)!} /
                            </#if>
                        </#list>
                        <#if 26<=entry.permissions.size()>...</#if>
                    </td>
                    <td width="100">
                        <a href="${web_base}/system/role_permission!edit.htm?roleId=${(entry.roleId)!}"
                           title="编辑">[编辑]</a>
                    </td>
                </tr>
            </#list>
        <#else>
            <tr>
                <td colspan="9">
                    <div class="noRecord">
                        没有找到任何记录!
                    </div>
                </td>
            </tr>
        </#if>
    </table>

</@pageList>

</div>
</body>
</html>